Load packages

library(conflicted)
library(MASS)
library(dplyr)
library(zooper)
library(lubridate)
library(readr)
library(tidyr)
library(ggplot2)
library(sf)
library(readxl)
library(stringr)
library(mgcv)
library(purrr)
library(deltamapr)
library(scales)
library(here)

conflict_prefer("filter", "dplyr")
conflict_prefer("select", "dplyr")

Load and wrangle data

zoop_data<-Zoopsynther(Data_type="Community", Sources=c("EMP", "STN", "20mm", "FMWT"), Time_consistency = TRUE)
## Warning: Specifying `multiple = "error"` was deprecated in dplyr 1.1.1.
## ℹ Please use `relationship = "many-to-one"` instead.
## ℹ The deprecated feature was likely used in the zooper package.
##   Please report the issue at
##   <https://github.com/InteragencyEcologicalProgram/zooper/issues>.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## [1] "These species have no relatives in their size class common to all datasets and have been removed from one or more size classes: Ostracoda Adult (Meso), Cumacea Undifferentiated (Meso), Annelida Adult (Meso), Gammarus Adult (Meso), Orientomysis aspera Adult (Meso), Chironomidae Larva (Meso), Insecta Larva (Meso)"

Read in zoop mass conversions

zoop_mass_conversions<-read_excel(here("Data/SMSCG salinity modeling/Biomass conversions.xlsx"), sheet="Micro and Meso-zooplankton")%>%
  mutate(Taxname=case_when(Taxname=="Sinocalanus"~"Sinocalanus doerrii", # Change to help this match to zoop data
                           TRUE ~ Taxname),
         Taxlifestage=paste(Taxname, Lifestage))%>%
  select(Taxlifestage, CarbonWeight_ug)

Read in zoop groupings

zoop_groups<-read_csv(here("Data/zoopcrosswalk2.csv"), col_types=cols_only(Taxlifestage="c", IBMR="c"))%>%
  distinct()

Load Mysid biomass data

zoop_mysid<-read_excel(here("Data/1972-2020MysidBPUEMatrix.xlsx"), # EMP
                       sheet="Mysid_BPUE_matrix_1972-2020", na = "NA",
                       col_types = c(rep("numeric", 4), "date", "text", "text", rep("text", 7), rep("numeric", 8)))%>%
  select(Date=SampleDate, Station=StationNZ, BPUE=`Hyperacanthomysis longirostris`)%>% # Only select Hyperacanthomysis longirostris
  mutate(Source="EMP")%>%
  bind_rows(read_csv(here("Data/FMWT STN 2007to2019 Mysid BPUE.csv"), # FMWT/STN
                     col_types=cols_only(Station="c", SampleDate="c", Project="c", `Hyperacanthomysis longirostris`="d"))%>% 
              rename(Date=SampleDate, Source=Project, BPUE=`Hyperacanthomysis longirostris`)%>% # Only select Hyperacanthomysis longirostris
              mutate(Date=mdy(Date),
                     Station=recode(Station, MONT="Mont", HONK="Honk")))%>% #Get station names to match to main dataset
  mutate(BPUE_mysid=BPUE*1000, # Convert to ug
         Taxlifestage="Hyperacanthomysis longirostris Adult",
         SampleID=paste(Source, Station, Date),
         SizeClass="Macro")%>%
  select(SampleID, Taxlifestage, SizeClass, BPUE_mysid)

Start processing the zoop data

zoop_data_mass<-zoop_data%>%
  mutate(Taxlifestage=str_remove(Taxlifestage, fixed("_UnID")))%>%
  filter(
    !(SizeClass=="Meso" & #eliminating species which are counted in meso and micro and retained better in the micro net from the meso calcs
        
        Taxlifestage%in%c("Asplanchna Adult", "Copepoda Larva","Cyclopoida Juvenile", "Eurytemora Larva", "Harpacticoida Undifferentiated",
                          "Keratella Adult", "Limnoithona Adult", "Limnoithona Juvenile", "Limnoithona sinenesis Adult", "Limnoithona tetraspina
                                    Adult", "Oithona Adult", "Oithona Juvenile", "Oithona davisae Adult", "Polyarthra Adult","Pseudodiaptomus Larva", 
                          "Rotifera Adult", "Sinocalanus doerrii Larva", "Synchaeta Adult", "Synchaeta bicornis Adult", "Trichocerca Adult")) &
      
      !(SizeClass=="Micro" &Taxlifestage%in%c("Cirripedia Larva", "Cyclopoida Adult", "Oithona similis")) & #removing categories better retained in meso net from micro net matrix
      Order!="Amphipoda" & # Remove amphipods
      (Order!="Mysida" | Taxlifestage=="Hyperacanthomysis longirostris Adult"))%>% #Only retain Hyperacanthomysis longirostris
  mutate(Taxlifestage=recode(Taxlifestage, `Synchaeta bicornis Adult`="Synchaeta Adult", # Change some names to match to biomass conversion dataset
                             `Pseudodiaptomus Adult`="Pseudodiaptomus forbesi Adult",
                             `Acanthocyclops vernalis Adult`="Acanthocyclops Adult"))%>%
  left_join(zoop_mass_conversions, by="Taxlifestage")%>% # Add biomass conversions
  left_join(zoop_mysid, by=c("SampleID", "Taxlifestage", "SizeClass"))%>% # Add mysid biomass
  left_join(zoop_groups, by="Taxlifestage")%>% # Add IBMR categories
  mutate(BPUE=if_else(Taxlifestage=="Hyperacanthomysis longirostris Adult", BPUE_mysid, CPUE*CarbonWeight_ug))%>% # Create 1 BPUE variable
  filter(!is.na(BPUE) & !is.na(Latitude) & !is.na(Longitude) & !is.na(SalSurf))%>% # Removes any data without BPUE, which is currently restricted to Decapod Larvae, and H. longirostris from STN. Also removes 20mm and EMP EZ stations without coordinates
  group_by(IBMR)%>%
  mutate(flag=if_else(all(c("Micro", "Meso")%in%SizeClass), "Remove", "Keep"))%>% # This and the next 2 lines are meant to ensure that all categories are consistent across the surveys. Since only EMP samples microzoops, only EMP data can be used for categories that include both micro and mesozoops.
  ungroup()%>%
  filter(!(flag=="Remove" & Source!="EMP"))%>%
  select(SampleID, Station, Latitude, Longitude, SalSurf, Date, Year, IBMR, BPUE)%>%
  group_by(across(-BPUE))%>%
  summarise(BPUE=sum(BPUE), .groups="drop")%>% # Sum each IBMR categories
  st_as_sf(coords=c("Longitude", "Latitude"), crs=4326)%>%
  st_transform(crs=st_crs(deltamapr::R_DSIBM)) %>% 
  st_join(deltamapr::R_DSIBM %>%
            select(SUBREGION)) %>%
  st_drop_geometry() %>% 
  filter(SUBREGION %in% c("NW Suisun","SW Suisun","NE Suisun","SE Suisun","Confluence", "Suisun Marsh"))%>%
  mutate(doy=yday(Date), #Day of year
         Month=month(Date), # Month
         Year_fac=factor(Year), # Factor year for model random effect
         Station_fac=factor(Station), # Factor station for model random effect
         across(c(SalSurf, doy), list(s=~(.x-mean(.x))/sd(.x))), # Center and standardize predictors
         BPUE_log1p=log(BPUE+1)) # log1p transform BPUE for model

Check sample size

zoop_sample_size <- zoop_data_mass %>% 
  group_by(SampleID,Year,Month,SUBREGION,Station) %>% 
  summarise(BPUE=sum(BPUE)) %>% 
  mutate(Samplesize=1) %>%
  group_by(Year, Month, SUBREGION) %>% 
  summarise(mean_BPUE=mean(BPUE),Samplesize=sum(Samplesize)) %>%
  filter(Year>=1995)

ggplot(zoop_sample_size, aes(x=Year, y=Month, fill=Samplesize))+
  geom_tile()+
  scale_y_continuous(breaks=1:12, labels=month(1:12, label=T))+
  scale_fill_viridis_c(breaks=c(1,5,10,15,20))+
  facet_wrap(~SUBREGION)+
  theme_bw()

All the remaining brackish regions have sufficient sample size with the exception of NE Suisun. As such, NE Suisun is to be combined with SE Suisun while the rest of the regions are to be analyzed on their own.

Create a new column with IBMR edited regions to accomodate combination of NE and SE Suisun regions.

zoop_data_mass$Subregion_edit<-ifelse(zoop_data_mass$SUBREGION%in%c("NE Suisun", "SE Suisun"), "East Suisun", zoop_data_mass$SUBREGION)

Model

Prediction data

Set up prediction data for model

# Min year to start models
year_min<-1995

newdata_function<-function(region, data=zoop_data_mass, quant=0.99){
  
  lower<-(1-quant)/(2)
  upper<-1-lower
  
  data_filt<-data%>%
    filter(Subregion_edit%in%region & Year >= year_min)
  
  # Calculate monthly quantiles of salinity
  month_sal<-data_filt%>%
    group_by(Month)%>%
    summarise(l=quantile(SalSurf, lower),
              u=quantile(SalSurf, upper), .groups="drop")
  
  newdata<-expand_grid(date=mdy(paste(1:12, 15, 2001, sep="/")), # The 15th of each month on a non-leap year
                       SalSurf=seq(round(min(data_filt$SalSurf), 1), 
                                   round(max(data_filt$SalSurf), 1), by=0.1))%>% # Salinity sequence nicely rounded to 1 decimal
    mutate(Month=month(date),
           doy=yday(date), # Day of year
           SalSurf_s=(SalSurf-mean(data$SalSurf))/sd(data$SalSurf), # center and standardize salinity to match data
           doy_s=(doy-mean(data$doy))/sd(data$doy))%>% # center and standardize doy to match data
    left_join(month_sal, by="Month")%>%
    filter(SalSurf >= l & SalSurf <= u)%>% # Remove any salinity values outside the quantiles for each month
    select(Month, doy, doy_s, SalSurf, SalSurf_s)
  
}

newdata<-map(set_names(unique(zoop_data_mass$Subregion_edit)), newdata_function)

Posterior prediction function

# Function to generate posterior predictions from a gam model
# From https://stats.stackexchange.com/questions/190348/can-i-use-bootstrapping-to-estimate-the-uncertainty-in-a-maximum-value-of-a-gam
predict_posterior<-function(model, newdata, exclude, n=1e3, seed=999){
  Xp <- predict(model, newdata=newdata, type="lpmatrix", exclude=exclude, newdata.guaranteed=TRUE) ## map coefs to fitted curves
  beta <- coef(model)
  Vb   <- vcov(model) ## posterior mean and cov of coefs
  set.seed(seed)
  mrand <- mvrnorm(n, beta, Vb) ## simulate n rep coef vectors from posterior
  pred<-matrix(nrow=nrow(newdata), ncol=n)
  ilink <- family(model)$linkinv
  for (i in seq_len(n)) { 
    pred[,i]   <- ilink(Xp %*% mrand[i, ])
  }
  colnames(pred)<-paste("draw", 1:n, sep="_")
  pred<-as_tibble(pred)
  return(pred)
}

Model fitting

model

sal_model<-function(group,region,new_data=newdata){
  
  cat("<<<<<<<<<<<<<<<<<<<<<<< modeling", group, region, ">>>>>>>>>>>>>>>>>>>>>>>>>\n\n")
  
  new_data<-new_data[[region]]
  
  data<-filter(zoop_data_mass, IBMR==group & Subregion_edit==region & Year>=year_min)
  
  par(mfrow=c(2,2))
  
  if(length(unique(data$Station_fac))>1){
    model<-gam(BPUE_log1p ~ te(SalSurf_s, doy_s, k=c(5,5), bs=c("cs", "cc")) + 
                 s(Year_fac, bs="re") + s(Station_fac, bs="re"),
               data=data, 
               method="REML")
    
    random_effects<-c("s(Year_fac)", "s(Station_fac)")
    
  }else{
    
    model<-gam(BPUE_log1p ~ te(SalSurf_s, doy_s, k=c(5,5), bs=c("cs", "cc")) + 
                 s(Year_fac, bs="re"),
               data=data, 
               method="REML")
    
    random_effects<-c("s(Year_fac)")
  }
  
  cat("-------------gam check-------------\n")
  gam.check(model)
  
  cat("\n\n-------------summary-------------\n")
  print(summary(model))
  
  sal<-predict_posterior(model, new_data, random_effects)%>%
    bind_cols(new_data%>% # Add covariate columns before these columns
                select(-doy_s, -SalSurf_s), 
              .)
  return(sal)
}

Apply model to all groups and regions

model_factors<-expand_grid(IBMR=unique(zoop_data_mass$IBMR),
                           Subregion_edit=unique(zoop_data_mass$Subregion_edit))%>%
  mutate(IBMR=set_names(IBMR, paste(IBMR, Subregion_edit)))

sal_conversions<-pmap_dfr(model_factors, function(IBMR, Subregion_edit) sal_model(IBMR, Subregion_edit), .id = "IBMR_region")%>%
  mutate(IBMR=sapply(IBMR_region, function(x) str_split(x, " ", n=2)[[1]][1]),
         Region=factor(sapply(IBMR_region, function(x) str_split(x, " ", n=2)[[1]][2]),
                       levels=c("Confluence", "Suisun Marsh", "East Suisun", 
                                "NW Suisun", "SW Suisun")),
         Month=as.integer(Month))%>%
  select(-IBMR_region, -doy)%>%
  relocate(Region, Month, IBMR, SalSurf)
## <<<<<<<<<<<<<<<<<<<<<<< modeling acartela SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 9 iterations.
## Gradient range [-0.0008716295,0.0004190904]
## (score 1715.145 & scale 2.632838).
## Hessian positive definite, eigenvalue range [0.745521,435.8626].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value
## te(SalSurf_s,doy_s) 19.00 11.64    0.98    0.22
## s(Year_fac)         27.00 23.14      NA      NA
## s(Station_fac)       5.00  3.62      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   2.7432     0.7262   3.777  0.00017 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F              p-value    
## te(SalSurf_s,doy_s) 11.636     19 765.56 < 0.0000000000000002 ***
## s(Year_fac)         23.139     26  10.22 < 0.0000000000000002 ***
## s(Station_fac)       3.621      4  11.92           0.00000148 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.476   Deviance explained = 49.9%
## -REML = 1715.1  Scale est. = 2.6328    n = 872
## <<<<<<<<<<<<<<<<<<<<<<< modeling acartela NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.0000005608474,0.000000006506185]
## (score 2045.78 & scale 2.45869).
## Hessian positive definite, eigenvalue range [1.392725,526.3635].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value  
## te(SalSurf_s,doy_s) 19.00 16.00    0.95   0.035 *
## s(Year_fac)         27.00 24.70      NA      NA  
## s(Station_fac)       5.00  3.65      NA      NA  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value     Pr(>|t|)    
## (Intercept)   2.7000     0.4879   5.534 0.0000000399 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 16.002     19 242.22 <0.0000000000000002 ***
## s(Year_fac)         24.696     26  22.22 <0.0000000000000002 ***
## s(Station_fac)       3.647      4  31.48 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.615   Deviance explained = 63.1%
## -REML = 2045.8  Scale est. = 2.4587    n = 1053
## <<<<<<<<<<<<<<<<<<<<<<< modeling acartela East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.000008380611,0.000006853298]
## (score 4083.025 & scale 2.415967).
## Hessian positive definite, eigenvalue range [2.78405,1067.704].
## Model rank =  57 / 57 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 17.44    0.87 <0.0000000000000002 ***
## s(Year_fac)         27.00 25.51      NA                  NA    
## s(Station_fac)      10.00  7.68      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   4.1254     0.3596   11.47 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 17.441     19 918.26 <0.0000000000000002 ***
## s(Year_fac)         25.507     26  52.52 <0.0000000000000002 ***
## s(Station_fac)       7.681      9  14.49 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.701   Deviance explained = 70.8%
## -REML =   4083  Scale est. = 2.416     n = 2136
## <<<<<<<<<<<<<<<<<<<<<<< modeling acartela Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.0007116881,0.000442029]
## (score 3781.189 & scale 1.912601).
## Hessian positive definite, eigenvalue range [2.621942,1054.7].
## Model rank =  57 / 57 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 16.83    0.92 <0.0000000000000002 ***
## s(Year_fac)         27.00 25.21      NA                  NA    
## s(Station_fac)      10.00  7.32      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   3.9822     0.2334   17.06 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 16.831     19 3379.16 <0.0000000000000002 ***
## s(Year_fac)         25.208     26   35.19 <0.0000000000000002 ***
## s(Station_fac)       7.324      9   12.67 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.812   Deviance explained = 81.7%
## -REML = 3781.2  Scale est. = 1.9126    n = 2110
## <<<<<<<<<<<<<<<<<<<<<<< modeling acartela Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.003409491,0.002637421]
## (score 3082.202 & scale 1.829951).
## Hessian positive definite, eigenvalue range [1.971613,868.2386].
## Model rank =  55 / 55 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 17.08    0.93 <0.0000000000000002 ***
## s(Year_fac)         27.00 25.16      NA                  NA    
## s(Station_fac)       8.00  5.37      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   3.4836     0.2261    15.4 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df        F             p-value    
## te(SalSurf_s,doy_s) 17.081     19 1560.923 <0.0000000000000002 ***
## s(Year_fac)         25.160     26   28.588 <0.0000000000000002 ***
## s(Station_fac)       5.375      7    8.896 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.792   Deviance explained = 79.7%
## -REML = 3082.2  Scale est. = 1.83      n = 1737
## <<<<<<<<<<<<<<<<<<<<<<< modeling daphnia SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.00005421563,0.00002834637]
## (score 1372.149 & scale 1.251505).
## Hessian positive definite, eigenvalue range [0.00005421382,435.7183].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                            k'       edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.000000 13.854047    0.85 <0.0000000000000002 ***
## s(Year_fac)         27.000000 16.722465      NA                  NA    
## s(Station_fac)       5.000000  0.000218      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)  0.70178    0.06577   10.67 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                            edf Ref.df      F              p-value    
## te(SalSurf_s,doy_s) 13.8540466     19 81.357 < 0.0000000000000002 ***
## s(Year_fac)         16.7224645     26  1.909           0.00000161 ***
## s(Station_fac)       0.0002179      4  0.000                0.609    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.577   Deviance explained = 59.2%
## -REML = 1372.1  Scale est. = 1.2515    n = 872
## <<<<<<<<<<<<<<<<<<<<<<< modeling daphnia NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.0002354796,0.0001667292]
## (score 1643.394 & scale 1.195902).
## Hessian positive definite, eigenvalue range [1.044054,526.264].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 16.02     0.9 <0.0000000000000002 ***
## s(Year_fac)         27.00 20.36      NA                  NA    
## s(Station_fac)       5.00  2.41      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   0.9538     0.1173   8.133 0.00000000000000122 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F              p-value    
## te(SalSurf_s,doy_s) 16.025     19 207.332 < 0.0000000000000002 ***
## s(Year_fac)         20.356     26   3.316 < 0.0000000000000002 ***
## s(Station_fac)       2.411      4   4.598             0.000137 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.696   Deviance explained = 70.7%
## -REML = 1643.4  Scale est. = 1.1959    n = 1053
## <<<<<<<<<<<<<<<<<<<<<<< modeling daphnia East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.002248912,0.01393683]
## (score 3502.017 & scale 1.447167).
## Hessian positive definite, eigenvalue range [0.003379862,1067.659].
## Model rank =  57 / 57 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                         k'    edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.000 17.040    0.87 <0.0000000000000002 ***
## s(Year_fac)         27.000 24.208      NA                  NA    
## s(Station_fac)      10.000  0.108      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   1.3707     0.1083   12.65 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                         edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 17.0401     19 876.233 <0.0000000000000002 ***
## s(Year_fac)         24.2079     26  11.745 <0.0000000000000002 ***
## s(Station_fac)       0.1083      9   0.012               0.429    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.703   Deviance explained = 70.9%
## -REML =   3502  Scale est. = 1.4472    n = 2136
## <<<<<<<<<<<<<<<<<<<<<<< modeling daphnia Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 10 iterations.
## Gradient range [-0.001255597,0.001799851]
## (score 3901.874 & scale 2.207772).
## Hessian positive definite, eigenvalue range [0.001255846,1054.665].
## Model rank =  57 / 57 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                           k'      edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00000 16.22696    0.85 <0.0000000000000002 ***
## s(Year_fac)         27.00000 23.74698      NA                  NA    
## s(Station_fac)      10.00000  0.00614      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   1.8587     0.1183   15.71 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                           edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 16.226957     19 507.24 <0.0000000000000002 ***
## s(Year_fac)         23.746982     26  10.46 <0.0000000000000002 ***
## s(Station_fac)       0.006139      9   0.00               0.731    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.612   Deviance explained =   62%
## -REML = 3901.9  Scale est. = 2.2078    n = 2110
## <<<<<<<<<<<<<<<<<<<<<<< modeling daphnia Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.002942225,0.002626776]
## (score 2999.595 & scale 1.730712).
## Hessian positive definite, eigenvalue range [1.583553,868.1809].
## Model rank =  55 / 55 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 14.82    0.92 <0.0000000000000002 ***
## s(Year_fac)         27.00 22.04      NA                  NA    
## s(Station_fac)       8.00  4.07      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   0.9035     0.1074   8.415 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F              p-value    
## te(SalSurf_s,doy_s) 14.817     19 117.699 < 0.0000000000000002 ***
## s(Year_fac)         22.044     26   5.039 < 0.0000000000000002 ***
## s(Station_fac)       4.072      7   3.154            0.0000781 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.492   Deviance explained = 50.4%
## -REML = 2999.6  Scale est. = 1.7307    n = 1737
## <<<<<<<<<<<<<<<<<<<<<<< modeling eurytem SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.00002918423,0.00002499156]
## (score 1666.547 & scale 2.454981).
## Hessian positive definite, eigenvalue range [1.450192,435.6341].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value  
## te(SalSurf_s,doy_s) 19.00 13.01    0.94   0.025 *
## s(Year_fac)         27.00 11.48      NA      NA  
## s(Station_fac)       5.00  3.65      NA      NA  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value  Pr(>|t|)    
## (Intercept)   2.9138     0.7162   4.069 0.0000517 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df        F             p-value    
## te(SalSurf_s,doy_s) 13.014     19 1218.972 <0.0000000000000002 ***
## s(Year_fac)         11.485     26    0.799              0.0105 *  
## s(Station_fac)       3.655      4   11.772 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.649   Deviance explained =   66%
## -REML = 1666.5  Scale est. = 2.455     n = 872
## <<<<<<<<<<<<<<<<<<<<<<< modeling eurytem NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.00002849287,0.00001875845]
## (score 1957.782 & scale 2.169344).
## Hessian positive definite, eigenvalue range [0.235629,526.2546].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value  
## te(SalSurf_s,doy_s) 19.00 16.81    0.95   0.035 *
## s(Year_fac)         27.00 19.66      NA      NA  
## s(Station_fac)       5.00  1.18      NA      NA  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   1.8925     0.1099   17.22 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 16.813     19 149.515 <0.0000000000000002 ***
## s(Year_fac)         19.660     26   2.846 <0.0000000000000002 ***
## s(Station_fac)       1.182      4   0.581               0.138    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.647   Deviance explained =   66%
## -REML = 1957.8  Scale est. = 2.1693    n = 1053
## <<<<<<<<<<<<<<<<<<<<<<< modeling eurytem East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.001657614,0.001595037]
## (score 3886.496 & scale 2.07351).
## Hessian positive definite, eigenvalue range [1.325601,1067.664].
## Model rank =  57 / 57 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 17.20    0.76 <0.0000000000000002 ***
## s(Year_fac)         27.00 22.36      NA                  NA    
## s(Station_fac)      10.00  6.49      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)    2.227      0.150   14.85 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F              p-value    
## te(SalSurf_s,doy_s) 17.199     19 444.675 < 0.0000000000000002 ***
## s(Year_fac)         22.357     26   5.184 < 0.0000000000000002 ***
## s(Station_fac)       6.486      9   3.499            0.0000508 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.685   Deviance explained = 69.2%
## -REML = 3886.5  Scale est. = 2.0735    n = 2136
## <<<<<<<<<<<<<<<<<<<<<<< modeling eurytem Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 9 iterations.
## Gradient range [-0.00001963028,0.00001875904]
## (score 3932.873 & scale 2.26824).
## Hessian positive definite, eigenvalue range [0.09758625,1054.656].
## Model rank =  57 / 57 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 17.27    0.73 <0.0000000000000002 ***
## s(Year_fac)         27.00 22.40      NA                  NA    
## s(Station_fac)      10.00  1.07      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)  2.31702    0.09598   24.14 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 17.265     19 271.431 <0.0000000000000002 ***
## s(Year_fac)         22.404     26   6.288 <0.0000000000000002 ***
## s(Station_fac)       1.067      9   0.148               0.282    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.668   Deviance explained = 67.5%
## -REML = 3932.9  Scale est. = 2.2682    n = 2110
## <<<<<<<<<<<<<<<<<<<<<<< modeling eurytem Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.001657828,0.001185811]
## (score 3360.674 & scale 2.604153).
## Hessian positive definite, eigenvalue range [1.197695,868.1907].
## Model rank =  55 / 55 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 14.31    0.76 <0.0000000000000002 ***
## s(Year_fac)         27.00 22.56      NA                  NA    
## s(Station_fac)       8.00  5.66      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   3.3023     0.1916   17.23 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 14.306     19 405.659 <0.0000000000000002 ***
## s(Year_fac)         22.561     26   5.804 <0.0000000000000002 ***
## s(Station_fac)       5.661      7  12.992 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.709   Deviance explained = 71.6%
## -REML = 3360.7  Scale est. = 2.6042    n = 1737
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcalad SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.00000740484,0.000006403041]
## (score 1748.119 & scale 2.921862).
## Hessian positive definite, eigenvalue range [1.439647,435.7756].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value
## te(SalSurf_s,doy_s) 19.00 13.09    1.01    0.66
## s(Year_fac)         27.00 19.50      NA      NA
## s(Station_fac)       5.00  2.86      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   6.5462     0.3625   18.06 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                       edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 13.09     19 121.214 <0.0000000000000002 ***
## s(Year_fac)         19.50     26   3.572 <0.0000000000000002 ***
## s(Station_fac)       2.86      4  28.702 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.405   Deviance explained =   43%
## -REML = 1748.1  Scale est. = 2.9219    n = 872
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcalad NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.0007709091,0.0006190273]
## (score 1898.882 & scale 1.993082).
## Hessian positive definite, eigenvalue range [1.360136,526.0948].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value  
## te(SalSurf_s,doy_s) 19.00 14.97    0.95   0.045 *
## s(Year_fac)         27.00  8.34      NA      NA  
## s(Station_fac)       5.00  3.91      NA      NA  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value         Pr(>|t|)    
## (Intercept)   5.4053     0.7842   6.893 0.00000000000955 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 14.969     19 618.921 <0.0000000000000002 ***
## s(Year_fac)          8.341     26   0.503              0.0463 *  
## s(Station_fac)       3.906      4  26.054 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.431   Deviance explained = 44.6%
## -REML = 1898.9  Scale est. = 1.9931    n = 1053
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcalad East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.002786366,0.002340382]
## (score 4161.448 & scale 2.727249).
## Hessian positive definite, eigenvalue range [1.782847,1067.646].
## Model rank =  57 / 57 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 14.39    0.92 <0.0000000000000002 ***
## s(Year_fac)         27.00 21.54      NA                  NA    
## s(Station_fac)      10.00  6.03      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)    5.298      0.147   36.03 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 14.387     19 125.917 <0.0000000000000002 ***
## s(Year_fac)         21.540     26   5.456 <0.0000000000000002 ***
## s(Station_fac)       6.031      9   7.154 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.344   Deviance explained = 35.7%
## -REML = 4161.4  Scale est. = 2.7272    n = 2136
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcalad Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.000001512857,0.00000005071482]
## (score 4275.938 & scale 3.11497).
## Hessian positive definite, eigenvalue range [0.8845194,1054.681].
## Model rank =  57 / 57 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 16.37    0.88 <0.0000000000000002 ***
## s(Year_fac)         27.00 24.63      NA                  NA    
## s(Station_fac)      10.00  4.13      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)    4.227      0.190   22.25 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 16.366     19 272.859 <0.0000000000000002 ***
## s(Year_fac)         24.633     26  17.693 <0.0000000000000002 ***
## s(Station_fac)       4.131      9   1.246              0.0155 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.572   Deviance explained = 58.1%
## -REML = 4275.9  Scale est. = 3.115     n = 2110
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcalad Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.0002127979,0.0001948337]
## (score 3435.893 & scale 2.814025).
## Hessian positive definite, eigenvalue range [2.029276,868.2004].
## Model rank =  55 / 55 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 16.77    0.93 <0.0000000000000002 ***
## s(Year_fac)         27.00 22.72      NA                  NA    
## s(Station_fac)       8.00  5.58      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.2511     0.1961   26.77 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 16.768     19 236.684 <0.0000000000000002 ***
## s(Year_fac)         22.717     26   8.645 <0.0000000000000002 ***
## s(Station_fac)       5.578      7  10.806 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.524   Deviance explained = 53.7%
## -REML = 3435.9  Scale est. = 2.814     n = 1737
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcaljuv SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.00003002771,0.00002698134]
## (score 1347.676 & scale 1.182251).
## Hessian positive definite, eigenvalue range [1.033518,435.6758].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value
## te(SalSurf_s,doy_s) 19.00 12.88    1.03    0.79
## s(Year_fac)         27.00 14.48      NA      NA
## s(Station_fac)       5.00  3.39      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   7.0229     0.3565    19.7 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F   p-value    
## te(SalSurf_s,doy_s) 12.881     19 44.567   0.00172 ** 
## s(Year_fac)         14.475     26  1.204   0.00101 ** 
## s(Station_fac)       3.394      4  6.872 0.0000186 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.336   Deviance explained =   36%
## -REML = 1347.7  Scale est. = 1.1823    n = 872
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcaljuv NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.0004397659,0.00006630588]
## (score 1546.86 & scale 0.9994358).
## Hessian positive definite, eigenvalue range [0.1461839,526.2813].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                         k'    edf k-index p-value  
## te(SalSurf_s,doy_s) 19.000 15.254    0.95   0.015 *
## s(Year_fac)         27.000 21.608      NA      NA  
## s(Station_fac)       5.000  0.933      NA      NA  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)  6.49101    0.08532   76.08 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                         edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 15.2536     19 68.619 <0.0000000000000002 ***
## s(Year_fac)         21.6084     26  4.701 <0.0000000000000002 ***
## s(Station_fac)       0.9327      4  0.387               0.194    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.402   Deviance explained = 42.4%
## -REML = 1546.9  Scale est. = 0.99944   n = 1053
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcaljuv East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 10 iterations.
## Gradient range [-0.0009993936,0.0001906519]
## (score 3114.095 & scale 1.009187).
## Hessian positive definite, eigenvalue range [2.184908,1067.652].
## Model rank =  57 / 57 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 16.87    0.83 <0.0000000000000002 ***
## s(Year_fac)         27.00 21.08      NA                  NA    
## s(Station_fac)      10.00  7.07      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   6.6135     0.1213   54.53 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                       edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 16.87     19 247.718 <0.0000000000000002 ***
## s(Year_fac)         21.08     26   5.007 <0.0000000000000002 ***
## s(Station_fac)       7.07      9   8.499 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.457   Deviance explained = 46.8%
## -REML = 3114.1  Scale est. = 1.0092    n = 2136
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcaljuv Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 13 iterations.
## Gradient range [-0.00002484854,0.000005750016]
## (score 2857.83 & scale 0.8144757).
## Hessian positive definite, eigenvalue range [2.78271,1054.664].
## Model rank =  57 / 57 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 16.78    0.77 <0.0000000000000002 ***
## s(Year_fac)         27.00 22.18      NA                  NA    
## s(Station_fac)      10.00  7.25      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   6.7913     0.1025   66.24 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 16.778     19 842.019 <0.0000000000000002 ***
## s(Year_fac)         22.185     26   6.579 <0.0000000000000002 ***
## s(Station_fac)       7.255      9  14.314 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.662   Deviance explained = 66.9%
## -REML = 2857.8  Scale est. = 0.81448   n = 2110
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcaljuv Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.001746193,0.001381503]
## (score 2504.624 & scale 0.9664801).
## Hessian positive definite, eigenvalue range [2.16893,868.1696].
## Model rank =  55 / 55 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                       k'  edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.0 16.7    0.91 <0.0000000000000002 ***
## s(Year_fac)         27.0 19.9      NA                  NA    
## s(Station_fac)       8.0  6.6      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   6.7287     0.1997    33.7 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 16.709     19 198.963 <0.0000000000000002 ***
## s(Year_fac)         19.881     26   3.529 <0.0000000000000002 ***
## s(Station_fac)       6.597      7  50.529 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.413   Deviance explained = 42.7%
## -REML = 2504.6  Scale est. = 0.96648   n = 1737
## <<<<<<<<<<<<<<<<<<<<<<< modeling othclad SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.0002622482,0.0002063187]
## (score 1324.978 & scale 1.103844).
## Hessian positive definite, eigenvalue range [0.0002622413,435.8117].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                           k'      edf k-index p-value
## te(SalSurf_s,doy_s) 19.00000 11.73450    1.01    0.55
## s(Year_fac)         27.00000 21.48516      NA      NA
## s(Station_fac)       5.00000  0.00102      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)  1.09715    0.08954   12.25 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                           edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 11.734497     19 229.46 <0.0000000000000002 ***
## s(Year_fac)         21.485159     26   4.08 <0.0000000000000002 ***
## s(Station_fac)       0.001016      4   0.00               0.619    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.709   Deviance explained =   72%
## -REML =   1325  Scale est. = 1.1038    n = 872
## <<<<<<<<<<<<<<<<<<<<<<< modeling othclad NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.000001289951,0.000001085011]
## (score 1544.096 & scale 0.9911362).
## Hessian positive definite, eigenvalue range [0.8351677,526.2886].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 13.87    0.86 <0.0000000000000002 ***
## s(Year_fac)         27.00 22.13      NA                  NA    
## s(Station_fac)       5.00  2.28      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   1.2355     0.1124   10.99 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F              p-value    
## te(SalSurf_s,doy_s) 13.870     19 471.136 < 0.0000000000000002 ***
## s(Year_fac)         22.129     26   5.370 < 0.0000000000000002 ***
## s(Station_fac)       2.285      4   3.515              0.00107 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.773   Deviance explained = 78.1%
## -REML = 1544.1  Scale est. = 0.99114   n = 1053
## <<<<<<<<<<<<<<<<<<<<<<< modeling othclad East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.00002767437,0.00002421569]
## (score 3266.821 & scale 1.154538).
## Hessian positive definite, eigenvalue range [0.9006104,1067.682].
## Model rank =  57 / 57 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 16.28    0.83 <0.0000000000000002 ***
## s(Year_fac)         27.00 24.66      NA                  NA    
## s(Station_fac)      10.00  4.63      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   1.8052     0.1211   14.91 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df        F              p-value    
## te(SalSurf_s,doy_s) 16.275     19 2273.622 < 0.0000000000000002 ***
## s(Year_fac)         24.661     26   16.979 < 0.0000000000000002 ***
## s(Station_fac)       4.628      9    1.952              0.00233 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.775   Deviance explained =   78%
## -REML = 3266.8  Scale est. = 1.1545    n = 2136
## <<<<<<<<<<<<<<<<<<<<<<< modeling othclad Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.0009296275,0.0005881898]
## (score 3492.962 & scale 1.496059).
## Hessian positive definite, eigenvalue range [1.692354,1054.675].
## Model rank =  57 / 57 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 13.21     0.9 <0.0000000000000002 ***
## s(Year_fac)         27.00 24.21      NA                  NA    
## s(Station_fac)      10.00  6.79      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   2.8809     0.1436   20.06 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 13.213     19 1737.13 <0.0000000000000002 ***
## s(Year_fac)         24.207     26   14.65 <0.0000000000000002 ***
## s(Station_fac)       6.788      9   11.76 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.692   Deviance explained = 69.9%
## -REML =   3493  Scale est. = 1.4961    n = 2110
## <<<<<<<<<<<<<<<<<<<<<<< modeling othclad Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.0008224294,0.000521716]
## (score 2813.215 & scale 1.383136).
## Hessian positive definite, eigenvalue range [1.692053,868.2037].
## Model rank =  55 / 55 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value  
## te(SalSurf_s,doy_s) 19.00 13.42    0.97   0.045 *
## s(Year_fac)         27.00 23.89      NA      NA  
## s(Station_fac)       8.00  5.71      NA      NA  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   1.3544     0.1568   8.639 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 13.419     19 487.05 <0.0000000000000002 ***
## s(Year_fac)         23.893     26  11.63 <0.0000000000000002 ***
## s(Station_fac)       5.711      7  15.26 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.561   Deviance explained = 57.2%
## -REML = 2813.2  Scale est. = 1.3831    n = 1737
## <<<<<<<<<<<<<<<<<<<<<<< modeling pdiapfor SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.001209362,0.001061379]
## (score 1678.197 & scale 2.439588).
## Hessian positive definite, eigenvalue range [0.6670521,435.8292].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value
## te(SalSurf_s,doy_s) 19.00 13.45    0.97    0.12
## s(Year_fac)         27.00 21.44      NA      NA
## s(Station_fac)       5.00  3.06      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)    3.120      0.393    7.94 0.00000000000000651 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 13.449     19 635.499 <0.0000000000000002 ***
## s(Year_fac)         21.439     26   4.255 <0.0000000000000002 ***
## s(Station_fac)       3.058      4   5.063               0.001 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.586   Deviance explained = 60.4%
## -REML = 1678.2  Scale est. = 2.4396    n = 872
## <<<<<<<<<<<<<<<<<<<<<<< modeling pdiapfor NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 10 iterations.
## Gradient range [-0.00007542177,0.0002550636]
## (score 1950.179 & scale 2.164107).
## Hessian positive definite, eigenvalue range [0.00007543682,526.2812].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                            k'       edf k-index p-value   
## te(SalSurf_s,doy_s) 19.000000 12.265116    0.95   0.005 **
## s(Year_fac)         27.000000 22.271044      NA      NA   
## s(Station_fac)       5.000000  0.000674      NA      NA   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   3.3517     0.1288   26.02 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                            edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 12.2651160     19 181.615 <0.0000000000000002 ***
## s(Year_fac)         22.2710441     26   5.172 <0.0000000000000002 ***
## s(Station_fac)       0.0006742      4   0.000                0.47    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =   0.62   Deviance explained = 63.2%
## -REML = 1950.2  Scale est. = 2.1641    n = 1053
## <<<<<<<<<<<<<<<<<<<<<<< modeling pdiapfor East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 10 iterations.
## Gradient range [-0.001934971,0.00185498]
## (score 3995.704 & scale 2.313708).
## Hessian positive definite, eigenvalue range [1.573728,1067.667].
## Model rank =  57 / 57 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 13.80     0.8 <0.0000000000000002 ***
## s(Year_fac)         27.00 23.50      NA                  NA    
## s(Station_fac)      10.00  6.49      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   4.2737     0.1712   24.96 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 13.797     19 857.975 <0.0000000000000002 ***
## s(Year_fac)         23.498     26   9.554 <0.0000000000000002 ***
## s(Station_fac)       6.491      9   7.949 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.669   Deviance explained = 67.6%
## -REML = 3995.7  Scale est. = 2.3137    n = 2136
## <<<<<<<<<<<<<<<<<<<<<<< modeling pdiapfor Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 12 iterations.
## Gradient range [-0.00002025915,0.00001873809]
## (score 3930.686 & scale 2.268858).
## Hessian positive definite, eigenvalue range [1.529428,1054.668].
## Model rank =  57 / 57 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                       k'  edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.0 14.2    0.69 <0.0000000000000002 ***
## s(Year_fac)         27.0 23.6      NA                  NA    
## s(Station_fac)      10.0  6.5      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)    5.970      0.153   39.01 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 14.157     19 513.999 <0.0000000000000002 ***
## s(Year_fac)         23.571     26   9.920 <0.0000000000000002 ***
## s(Station_fac)       6.498      9   6.875 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.701   Deviance explained = 70.7%
## -REML = 3930.7  Scale est. = 2.2689    n = 2110
## <<<<<<<<<<<<<<<<<<<<<<< modeling pdiapfor Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 9 iterations.
## Gradient range [-0.00004839245,0.00003978214]
## (score 3157.63 & scale 2.004973).
## Hessian positive definite, eigenvalue range [1.277001,868.2299].
## Model rank =  55 / 55 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 16.31     0.9 <0.0000000000000002 ***
## s(Year_fac)         27.00 24.73      NA                  NA    
## s(Station_fac)       8.00  6.42      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.2125     0.2825   18.45 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 16.312     19 2458.70 <0.0000000000000002 ***
## s(Year_fac)         24.734     26   18.02 <0.0000000000000002 ***
## s(Station_fac)       6.418      7   29.46 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =    0.7   Deviance explained = 70.8%
## -REML = 3157.6  Scale est. = 2.005     n = 1737
## <<<<<<<<<<<<<<<<<<<<<<< modeling allcopnaup SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.000154612,0.00007258112]
## (score 601.3534 & scale 2.330002).
## Hessian positive definite, eigenvalue range [0.0001545943,158.25].
## Model rank =  50 / 50 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                            k'       edf k-index p-value
## te(SalSurf_s,doy_s) 19.000000  7.843525    1.19       1
## s(Year_fac)         27.000000 11.179917      NA      NA
## s(Station_fac)       3.000000  0.000455      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   1.1026     0.1156   9.541 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                            edf Ref.df      F              p-value    
## te(SalSurf_s,doy_s)  7.8435253     19 10.457 < 0.0000000000000002 ***
## s(Year_fac)         11.1799165     26  0.784              0.00904 ** 
## s(Station_fac)       0.0004546      2  0.000              0.69048    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.372   Deviance explained =   41%
## -REML = 601.35  Scale est. = 2.33      n = 317
## <<<<<<<<<<<<<<<<<<<<<<< modeling allcopnaup NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.0000001103286,0.000000005068733]
## (score 617.7484 & scale 2.599896).
## Hessian positive definite, eigenvalue range [1.217475,155.1691].
## Model rank =  47 / 47 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value
## te(SalSurf_s,doy_s) 19.00  9.52    0.98    0.36
## s(Year_fac)         27.00 18.80      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   1.4834     0.1786   8.304 0.00000000000000432 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s)  9.521     19 13.289 <0.0000000000000002 ***
## s(Year_fac)         18.803     26  2.571 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.443   Deviance explained = 49.4%
## -REML = 617.75  Scale est. = 2.5999    n = 310
## <<<<<<<<<<<<<<<<<<<<<<< modeling allcopnaup East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.0003086585,0.0002553844]
## (score 1262.904 & scale 2.221373).
## Hessian positive definite, eigenvalue range [0.4256681,334.4252].
## Model rank =  51 / 51 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 12.91    0.91 <0.0000000000000002 ***
## s(Year_fac)         27.00 21.63      NA                  NA    
## s(Station_fac)       4.00  1.84      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value             Pr(>|t|)    
## (Intercept)   1.7264     0.2072   8.334 0.000000000000000489 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 12.909     19 49.826 <0.0000000000000002 ***
## s(Year_fac)         21.634     26  5.032 <0.0000000000000002 ***
## s(Station_fac)       1.841      3  2.151              0.0305 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.536   Deviance explained = 56.1%
## -REML = 1262.9  Scale est. = 2.2214    n = 669
## <<<<<<<<<<<<<<<<<<<<<<< modeling allcopnaup Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 9 iterations.
## Gradient range [-0.0004303728,0.00045683]
## (score 1345.29 & scale 2.474344).
## Hessian positive definite, eigenvalue range [0.1057984,347.3914].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                         k'    edf k-index p-value   
## te(SalSurf_s,doy_s) 19.000 12.154    0.89    0.01 **
## s(Year_fac)         27.000 21.371      NA      NA   
## s(Station_fac)       5.000  0.522      NA      NA   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   1.7959     0.1531   11.73 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                         edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 12.1538     19 29.248 <0.0000000000000002 ***
## s(Year_fac)         21.3712     26  4.793 <0.0000000000000002 ***
## s(Station_fac)       0.5224      4  0.207               0.197    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.468   Deviance explained = 49.4%
## -REML = 1345.3  Scale est. = 2.4743    n = 695
## <<<<<<<<<<<<<<<<<<<<<<< modeling allcopnaup Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 9 iterations.
## Gradient range [-0.0002836337,0.0000007719298]
## (score 1324.655 & scale 3.653853).
## Hessian positive definite, eigenvalue range [0.0002834728,310.4626].
## Model rank =  49 / 49 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                            k'       edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.000000  9.383887    0.89 <0.0000000000000002 ***
## s(Year_fac)         27.000000 22.656783      NA                  NA    
## s(Station_fac)       2.000000  0.000568      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value           Pr(>|t|)    
## (Intercept)   1.7121     0.2205   7.764 0.0000000000000368 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                            edf Ref.df     F             p-value    
## te(SalSurf_s,doy_s)  9.3838866     19 17.06 <0.0000000000000002 ***
## s(Year_fac)         22.6567829     26  6.76 <0.0000000000000002 ***
## s(Station_fac)       0.0005682      1  0.00               0.968    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.399   Deviance explained =   43%
## -REML = 1324.7  Scale est. = 3.6539    n = 621
## <<<<<<<<<<<<<<<<<<<<<<< modeling limno SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 5 iterations.
## Gradient range [-0.00005651404,0.00005859625]
## (score 681.6302 & scale 3.422221).
## Hessian positive definite, eigenvalue range [0.00004508318,161.4539].
## Model rank =  50 / 50 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                            k'       edf k-index p-value   
## te(SalSurf_s,doy_s) 19.000000  9.333769    0.88   0.005 **
## s(Year_fac)         27.000000 15.551463      NA      NA   
## s(Station_fac)       3.000000  0.000172      NA      NA   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.6536     0.1665   33.96 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                            edf Ref.df     F              p-value    
## te(SalSurf_s,doy_s)  9.3337692     19 7.302 < 0.0000000000000002 ***
## s(Year_fac)         15.5514628     26 1.494             0.000107 ***
## s(Station_fac)       0.0001718      2 0.000             0.583339    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.343   Deviance explained = 39.4%
## -REML = 681.63  Scale est. = 3.4222    n = 323
## <<<<<<<<<<<<<<<<<<<<<<< modeling limno NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.000150143,0.00009574354]
## (score 600.4573 & scale 2.201123).
## Hessian positive definite, eigenvalue range [1.593401,156.5484].
## Model rank =  47 / 47 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                       k'  edf k-index p-value
## te(SalSurf_s,doy_s) 19.0 11.7    0.98     0.3
## s(Year_fac)         27.0 16.2      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   6.4074     0.1397   45.85 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                       edf Ref.df     F              p-value    
## te(SalSurf_s,doy_s) 11.75     19 46.76 < 0.0000000000000002 ***
## s(Year_fac)         16.17     26  1.67            0.0000324 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.703   Deviance explained =   73%
## -REML = 600.46  Scale est. = 2.2011    n = 313
## <<<<<<<<<<<<<<<<<<<<<<< modeling limno East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 10 iterations.
## Gradient range [-0.000000239289,0.0000001464564]
## (score 1236.472 & scale 1.965841).
## Hessian positive definite, eigenvalue range [0.8025186,335.9462].
## Model rank =  51 / 51 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 15.16    0.85 <0.0000000000000002 ***
## s(Year_fac)         27.00 21.43      NA                  NA    
## s(Station_fac)       4.00  2.32      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)    6.765      0.245   27.62 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F              p-value    
## te(SalSurf_s,doy_s) 15.158     19 123.851 < 0.0000000000000002 ***
## s(Year_fac)         21.432     26   4.426 < 0.0000000000000002 ***
## s(Station_fac)       2.319      3   5.541             0.000576 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.703   Deviance explained =   72%
## -REML = 1236.5  Scale est. = 1.9658    n = 672
## <<<<<<<<<<<<<<<<<<<<<<< modeling limno Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.00004883231,0.000008133469]
## (score 1345.344 & scale 2.325183).
## Hessian positive definite, eigenvalue range [1.009805,350.4133].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value  
## te(SalSurf_s,doy_s) 19.00 14.78    0.95    0.09 .
## s(Year_fac)         27.00 21.16      NA      NA  
## s(Station_fac)       5.00  2.34      NA      NA  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.4572     0.2244   24.32 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F              p-value    
## te(SalSurf_s,doy_s) 14.784     19 187.879 < 0.0000000000000002 ***
## s(Year_fac)         21.155     26   4.447 < 0.0000000000000002 ***
## s(Station_fac)       2.337      4   5.369            0.0000308 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.748   Deviance explained = 76.2%
## -REML = 1345.3  Scale est. = 2.3252    n = 701
## <<<<<<<<<<<<<<<<<<<<<<< modeling limno Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.000001815078,0.000001657233]
## (score 1260.726 & scale 2.853199).
## Hessian positive definite, eigenvalue range [0.4726169,313.8115].
## Model rank =  49 / 49 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                         k'    edf k-index p-value
## te(SalSurf_s,doy_s) 19.000 13.894    0.96    0.13
## s(Year_fac)         27.000 16.906      NA      NA
## s(Station_fac)       2.000  0.973      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.8838     0.4269   13.78 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                         edf Ref.df      F              p-value    
## te(SalSurf_s,doy_s) 13.8945     19 92.214 < 0.0000000000000002 ***
## s(Year_fac)         16.9063     26  1.801           0.00000819 ***
## s(Station_fac)       0.9731      1 36.475 < 0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.693   Deviance explained = 70.8%
## -REML = 1260.7  Scale est. = 2.8532    n = 628
## <<<<<<<<<<<<<<<<<<<<<<< modeling mysid SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 5 iterations.
## Gradient range [-0.0003850967,0.0002974669]
## (score 800.589 & scale 4.432278).
## Hessian positive definite, eigenvalue range [0.1906857,177.1153].
## Model rank =  50 / 50 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                         k'    edf k-index p-value
## te(SalSurf_s,doy_s) 19.000 10.192    1.03    0.71
## s(Year_fac)         26.000 19.153      NA      NA
## s(Station_fac)       4.000  0.968      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   4.3767     0.3914   11.18 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                         edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 10.1924     19 25.218 <0.0000000000000002 ***
## s(Year_fac)         19.1528     25  3.255 <0.0000000000000002 ***
## s(Station_fac)       0.9676      3  0.933                0.12    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.544   Deviance explained = 58.3%
## -REML = 800.59  Scale est. = 4.4323    n = 354
## <<<<<<<<<<<<<<<<<<<<<<< modeling mysid NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.0000008772582,0.0000008332563]
## (score 905.1353 & scale 3.788971).
## Hessian positive definite, eigenvalue range [0.927108,208.44].
## Model rank =  50 / 50 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value  
## te(SalSurf_s,doy_s) 19.00  9.72    0.93   0.045 *
## s(Year_fac)         26.00 17.38      NA      NA  
## s(Station_fac)       4.00  2.94      NA      NA  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value  Pr(>|t|)    
## (Intercept)    4.450      1.089   4.084 0.0000538 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F              p-value    
## te(SalSurf_s,doy_s)  9.717     19 12.094              0.00571 ** 
## s(Year_fac)         17.383     25  2.461 < 0.0000000000000002 ***
## s(Station_fac)       2.942      3 93.494 < 0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.498   Deviance explained = 53.4%
## -REML = 905.14  Scale est. = 3.789     n = 417
## <<<<<<<<<<<<<<<<<<<<<<< modeling mysid East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 5 iterations.
## Gradient range [-0.0009278945,0.0005095288]
## (score 1797.217 & scale 3.738696).
## Hessian positive definite, eigenvalue range [2.018086,417.8264].
## Model rank =  56 / 56 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value   
## te(SalSurf_s,doy_s) 19.00 14.78    0.92    0.01 **
## s(Year_fac)         26.00 19.00      NA      NA   
## s(Station_fac)      10.00  8.11      NA      NA   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.2058     0.4966   10.48 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 14.785     19 66.931 <0.0000000000000002 ***
## s(Year_fac)         18.997     25  3.894 <0.0000000000000002 ***
## s(Station_fac)       8.105      9 15.436 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =   0.52   Deviance explained = 54.4%
## -REML = 1797.2  Scale est. = 3.7387    n = 836
## <<<<<<<<<<<<<<<<<<<<<<< modeling mysid Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 5 iterations.
## Gradient range [-0.0005055385,0.0003473337]
## (score 1647.357 & scale 3.17049).
## Hessian positive definite, eigenvalue range [2.158402,397.3703].
## Model rank =  55 / 55 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 15.08    0.92 <0.0000000000000002 ***
## s(Year_fac)         26.00 20.56      NA                  NA    
## s(Station_fac)       9.00  5.98      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   4.2493     0.3046   13.95 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 15.081     19 94.522 <0.0000000000000002 ***
## s(Year_fac)         20.563     25  4.866 <0.0000000000000002 ***
## s(Station_fac)       5.975      8  8.510 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.564   Deviance explained = 58.7%
## -REML = 1647.4  Scale est. = 3.1705    n = 795
## <<<<<<<<<<<<<<<<<<<<<<< modeling mysid Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.000000295379,0.0000002097751]
## (score 1484.766 & scale 3.363607).
## Hessian positive definite, eigenvalue range [1.725115,350.4737].
## Model rank =  53 / 53 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value   
## te(SalSurf_s,doy_s) 19.00 14.96    0.92   0.005 **
## s(Year_fac)         26.00 22.50      NA      NA   
## s(Station_fac)       7.00  5.46      NA      NA   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.2432     0.6501   8.065 0.00000000000000347 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 14.965     19 73.968 <0.0000000000000002 ***
## s(Year_fac)         22.501     25  8.827 <0.0000000000000002 ***
## s(Station_fac)       5.455      6 18.013 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.482   Deviance explained = 51.4%
## -REML = 1484.8  Scale est. = 3.3636    n = 701
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcyc SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 9 iterations.
## Gradient range [-0.00005964002,0.0001712767]
## (score 629.7834 & scale 2.730939).
## Hessian positive definite, eigenvalue range [0.1459018,161.0396].
## Model rank =  50 / 50 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value
## te(SalSurf_s,doy_s) 19.00  5.00    1.03     0.6
## s(Year_fac)         27.00  2.90      NA      NA
## s(Station_fac)       3.00  1.46      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   8.4562     0.7175   11.79 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                       edf Ref.df     F             p-value    
## te(SalSurf_s,doy_s) 5.000     19 2.808 <0.0000000000000002 ***
## s(Year_fac)         2.903     26 0.126              0.2963    
## s(Station_fac)      1.460      2 2.714              0.0256 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.161   Deviance explained = 18.6%
## -REML = 629.78  Scale est. = 2.7309    n = 323
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcyc NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.000002878506,0.0000001083962]
## (score 555.2359 & scale 1.622412).
## Hessian positive definite, eigenvalue range [1.065636,156.7009].
## Model rank =  47 / 47 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                       k'  edf k-index p-value
## te(SalSurf_s,doy_s) 19.0 11.9    1.02    0.59
## s(Year_fac)         27.0 18.8      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   9.5795     0.1406   68.14 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                       edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 11.88     19 27.467 <0.0000000000000002 ***
## s(Year_fac)         18.76     26  2.627 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.575   Deviance explained = 61.7%
## -REML = 555.24  Scale est. = 1.6224    n = 313
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcyc East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.00004830024,-0.0000008165355]
## (score 972.7094 & scale 0.8931744).
## Hessian positive definite, eigenvalue range [0.3911845,335.9375].
## Model rank =  51 / 51 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 15.80    0.86 <0.0000000000000002 ***
## s(Year_fac)         27.00 20.89      NA                  NA    
## s(Station_fac)       4.00  2.02      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   9.1882     0.1375   66.81 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 15.802     19 166.886 <0.0000000000000002 ***
## s(Year_fac)         20.895     26   4.228 <0.0000000000000002 ***
## s(Station_fac)       2.024      3   2.841              0.0135 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.731   Deviance explained = 74.7%
## -REML = 972.71  Scale est. = 0.89317   n = 672
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcyc Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.0000008461604,0.0000004443807]
## (score 1290.695 & scale 2.038263).
## Hessian positive definite, eigenvalue range [0.5739996,350.308].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value
## te(SalSurf_s,doy_s) 19.00 15.03    0.98    0.37
## s(Year_fac)         27.00 17.51      NA      NA
## s(Station_fac)       5.00  1.71      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   8.2805     0.1446   57.27 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F              p-value    
## te(SalSurf_s,doy_s) 15.029     19 81.877 < 0.0000000000000002 ***
## s(Year_fac)         17.515     26  2.014           0.00000169 ***
## s(Station_fac)       1.707      4  1.779               0.0112 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.619   Deviance explained = 63.7%
## -REML = 1290.7  Scale est. = 2.0383    n = 701
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcyc Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.0002591165,0.0001804243]
## (score 1009.343 & scale 1.285178).
## Hessian positive definite, eigenvalue range [0.4796187,313.777].
## Model rank =  49 / 49 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value
## te(SalSurf_s,doy_s) 19.00 14.08    0.97    0.27
## s(Year_fac)         27.00 15.53      NA      NA
## s(Station_fac)       2.00  0.98      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   9.3300     0.3297    28.3 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                         edf Ref.df     F             p-value    
## te(SalSurf_s,doy_s) 14.0845     19 57.45 <0.0000000000000002 ***
## s(Year_fac)         15.5314     26  1.46              0.0001 ***
## s(Station_fac)       0.9801      1 49.66 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.594   Deviance explained = 61.4%
## -REML = 1009.3  Scale est. = 1.2852    n = 628
## <<<<<<<<<<<<<<<<<<<<<<< modeling other SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.0001181306,0.00003164694]
## (score 657.8992 & scale 3.184574).
## Hessian positive definite, eigenvalue range [0.0001180994,158.5305].
## Model rank =  50 / 50 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                            k'       edf k-index p-value  
## te(SalSurf_s,doy_s) 19.000000  7.106973    0.89    0.02 *
## s(Year_fac)         27.000000 17.271773      NA      NA  
## s(Station_fac)       3.000000  0.000388      NA      NA  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   6.8324     0.1769   38.62 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                            edf Ref.df     F    p-value    
## te(SalSurf_s,doy_s)  7.1069729     19 2.572   0.000245 ***
## s(Year_fac)         17.2717731     26 2.036 0.00000223 ***
## s(Station_fac)       0.0003876      2 0.000   0.637914    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =   0.23   Deviance explained = 28.9%
## -REML =  657.9  Scale est. = 3.1846    n = 317
## <<<<<<<<<<<<<<<<<<<<<<< modeling other NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 9 iterations.
## Gradient range [-0.0000647543,0.0000307289]
## (score 680.149 & scale 4.224548).
## Hessian positive definite, eigenvalue range [0.08988397,154.8601].
## Model rank =  47 / 47 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                       k'  edf k-index p-value
## te(SalSurf_s,doy_s) 19.0  5.2    0.95    0.14
## s(Year_fac)         27.0 14.1      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   6.0952     0.1736   35.11 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df     F              p-value    
## te(SalSurf_s,doy_s)  5.203     19 3.012 < 0.0000000000000002 ***
## s(Year_fac)         14.064     26 1.183             0.000926 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.219   Deviance explained = 26.8%
## -REML = 680.15  Scale est. = 4.2245    n = 310
## <<<<<<<<<<<<<<<<<<<<<<< modeling other East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.0009663949,0.0005020085]
## (score 1416.959 & scale 3.606287).
## Hessian positive definite, eigenvalue range [0.3912403,334.3088].
## Model rank =  51 / 51 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 13.45    0.84 <0.0000000000000002 ***
## s(Year_fac)         27.00 17.70      NA                  NA    
## s(Station_fac)       4.00  1.53      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.9111     0.1991   29.69 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F              p-value    
## te(SalSurf_s,doy_s) 13.455     19 11.270 < 0.0000000000000002 ***
## s(Year_fac)         17.696     26  1.993           0.00000251 ***
## s(Station_fac)       1.529      3  1.954               0.0193 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.277   Deviance explained = 31.2%
## -REML =   1417  Scale est. = 3.6063    n = 669
## <<<<<<<<<<<<<<<<<<<<<<< modeling other Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 9 iterations.
## Gradient range [-0.0005075893,0.0001711053]
## (score 1439.908 & scale 3.172422).
## Hessian positive definite, eigenvalue range [0.0005072981,347.4243].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                           k'      edf k-index p-value   
## te(SalSurf_s,doy_s) 19.00000 14.77973     0.9   0.005 **
## s(Year_fac)         27.00000 21.63427      NA      NA   
## s(Station_fac)       5.00000  0.00136      NA      NA   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.5934     0.1717   32.57 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                           edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 14.779732     19 19.038 <0.0000000000000002 ***
## s(Year_fac)         21.634272     26  4.142 <0.0000000000000002 ***
## s(Station_fac)       0.001358      4  0.000               0.789    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.383   Deviance explained = 41.5%
## -REML = 1439.9  Scale est. = 3.1724    n = 695
## <<<<<<<<<<<<<<<<<<<<<<< modeling other Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.0005072905,0.0001734405]
## (score 1360.184 & scale 4.147165).
## Hessian positive definite, eigenvalue range [0.0005067784,310.3929].
## Model rank =  49 / 49 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                           k'      edf k-index p-value
## te(SalSurf_s,doy_s) 19.00000 11.13474    0.98    0.28
## s(Year_fac)         27.00000 20.34580      NA      NA
## s(Station_fac)       2.00000  0.00109      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.6270     0.1806   31.17 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                           edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 11.134744     19 12.288 <0.0000000000000002 ***
## s(Year_fac)         20.345798     26  3.618 <0.0000000000000002 ***
## s(Station_fac)       0.001089      1  0.000               0.793    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.353   Deviance explained = 38.6%
## -REML = 1360.2  Scale est. = 4.1472    n = 621
sal_conversions
## # A tibble: 88,728 × 1,004
##    Region   Month IBMR  SalSurf draw_1 draw_2 draw_3 draw_4 draw_5 draw_6 draw_7
##    <fct>    <int> <chr>   <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>
##  1 SW Suis…     1 acar…     0.1   5.23   3.30   5.58   5.05   3.90   3.70   3.65
##  2 SW Suis…     1 acar…     0.2   5.21   3.32   5.60   5.06   3.92   3.72   3.66
##  3 SW Suis…     1 acar…     0.3   5.18   3.33   5.62   5.06   3.93   3.74   3.67
##  4 SW Suis…     1 acar…     0.4   5.16   3.35   5.64   5.07   3.95   3.77   3.68
##  5 SW Suis…     1 acar…     0.5   5.14   3.36   5.66   5.07   3.97   3.79   3.68
##  6 SW Suis…     1 acar…     0.6   5.12   3.38   5.68   5.08   3.99   3.81   3.69
##  7 SW Suis…     1 acar…     0.7   5.09   3.39   5.70   5.08   4.00   3.83   3.70
##  8 SW Suis…     1 acar…     0.8   5.07   3.41   5.72   5.09   4.02   3.85   3.71
##  9 SW Suis…     1 acar…     0.9   5.05   3.42   5.74   5.09   4.04   3.87   3.71
## 10 SW Suis…     1 acar…     1     5.03   3.43   5.76   5.09   4.06   3.89   3.72
## # ℹ 88,718 more rows
## # ℹ 993 more variables: draw_8 <dbl>, draw_9 <dbl>, draw_10 <dbl>,
## #   draw_11 <dbl>, draw_12 <dbl>, draw_13 <dbl>, draw_14 <dbl>, draw_15 <dbl>,
## #   draw_16 <dbl>, draw_17 <dbl>, draw_18 <dbl>, draw_19 <dbl>, draw_20 <dbl>,
## #   draw_21 <dbl>, draw_22 <dbl>, draw_23 <dbl>, draw_24 <dbl>, draw_25 <dbl>,
## #   draw_26 <dbl>, draw_27 <dbl>, draw_28 <dbl>, draw_29 <dbl>, draw_30 <dbl>,
## #   draw_31 <dbl>, draw_32 <dbl>, draw_33 <dbl>, draw_34 <dbl>, …

Plot salinity-biomass relationships

sal_conversions_sum<-apply(select(sal_conversions, starts_with("draw_")), 1, 
                           function(x) quantile(x, c(0.025, 0.5, 0.975)))

sal_conversions_plot<-sal_conversions%>%
  select(-starts_with("draw_"))%>%
  bind_cols(tibble(l95=sal_conversions_sum["2.5%",], 
                   median=sal_conversions_sum["50%",], 
                   u95=sal_conversions_sum["97.5%",]))
plot_sal_conversions<-function(group, data=sal_conversions_plot){
  
  if(group!="All"){
    data<-filter(data, IBMR%in%group)
    
    ggplot(data, aes(x=SalSurf, y=median, ymin=l95, ymax=u95))+
      geom_ribbon(alpha=0.4, fill="chartreuse4")+
      ylab("Zooplankton biomass (log scale)")+
      facet_grid(Region~month(Month, label=T))+
      theme_bw()+
      theme(axis.text.x=element_text(angle=45, hjust=1))
  }else{
    ggplot(data, aes(x=SalSurf, y=median, ymin=l95, ymax=u95, fill=IBMR))+
      geom_ribbon(alpha=0.4)+
      ylab("Zooplankton biomass (log scale)")+
      facet_grid(Region~month(Month, label=T))+
      scale_fill_viridis_d()+
      theme_bw()+
      theme(axis.text.x=element_text(angle=45, hjust=1))
  }
}
# Create plots for each IBMR group
sal_conversion_plots <- tibble(group=c("All", unique(model_factors$IBMR)))%>%
  mutate(plot=map(group, plot_sal_conversions))

Salinity-biomass plots

All

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

Apply model

Load in SMSCG modeled salinity

scenario_file<-here("Data/CSAMP_DS_SDM_salinity_scenarios.csv")
scenario_names<-tibble(name=colnames(read.csv(scenario_file)))%>%
  filter(str_detect(name, "sal_"))%>%
  rev()

scenario_sal<-read_csv(scenario_file, guess_max=2800)%>%
  select(region, year, month, starts_with("sal_"))%>%
  mutate(across(c(year, month), as.integer),
         across(starts_with("sal_"), ~if_else(is.na(.x), sal_base, .x)))%>%
  filter(region%in%unique(zoop_data_mass$SUBREGION))%>%
  mutate(region=factor(region, 
                       levels=c("Confluence", "Suisun Marsh", "NE Suisun", 
                                "SE Suisun", "NW Suisun", "SW Suisun")))%>%
  pivot_longer(cols=starts_with("sal_"), names_to="Scenario", values_to="Salinity")%>% # Prepare data for easier plotting
  mutate(Scenario=factor(Scenario, 
                         levels=scenario_names$name),
         Salinity=round(Salinity, 1))

Plot SMSCG modeled salinity

ggplot(scenario_sal, 
       aes(x=year, y=Salinity, color=Scenario))+
  geom_line()+
  scale_color_viridis_d(direction=-1)+
  facet_grid(region ~ month(month, label=T))+
  theme_bw()+
  theme(legend.position = "bottom", axis.text.x=element_text(angle=45, hjust=1))

Calculate zoop abundance difference between each scenario and the baseline

zoop_saladjusted<-scenario_sal%>%
  mutate(Salinity=as.character(Salinity),
         IBMR=unique(model_factors$IBMR)[1])%>%
  complete(region, year, month, Scenario, IBMR=unique(model_factors$IBMR))%>%
  group_by(region, year, month, Scenario)%>%
  mutate(Salinity=na.exclude(Salinity),
         region2=if_else(region%in%c("NE Suisun", "SE Suisun"), "East Suisun", as.character(region)))%>%
  ungroup()%>%
  left_join(sal_conversions%>%
              mutate(SalSurf=as.character(SalSurf)),
            by=c("region2"="Region",
                 "month"="Month",
                 "Salinity"="SalSurf",
                 "IBMR"="IBMR"))%>%
  select(-Salinity, -region2)%>%
  mutate(across(starts_with("draw_"), ~exp(.x)-1))%>%
  pivot_longer(starts_with("draw_"), names_prefix="draw_", names_to="draw", values_to="fit")%>%
  mutate(fit=if_else(fit<0, 0, fit))%>%
  pivot_wider(names_from="Scenario", values_from="fit")%>%
  mutate(across(starts_with("sal_"), ~.x/sal_base))%>%
  group_by(region, year, month, IBMR)%>%
  summarise(across(starts_with("sal_"), 
                   list(median=~median(.x, na.rm=T), 
                        l95=~quantile(.x, 0.025, na.rm=T), 
                        u95=~quantile(.x, 0.975, na.rm=T))), 
            .groups="drop")

write_csv(zoop_saladjusted, here("Outputs", "CSAMP zoop sal adjustments.csv"))

You can find the final zoop salinity adjustments here

Prepare plots

Plot the missing model results resulting from out-of-range salinity values in the inputs

missing_adjusted_data<-zoop_saladjusted%>%
  select(-ends_with("l95"), -ends_with("u95"))%>%
  filter(IBMR=="acartela")%>%
  pivot_longer(cols=starts_with("sal_"), names_to="Scenario", values_to="zoop_change")%>%
  mutate(Scenario=str_remove(Scenario, fixed("_median")))

ggplot(missing_adjusted_data,
       aes(x=year, y=Scenario, fill=is.na(zoop_change)))+
  geom_tile()+
  scale_fill_viridis_d(name="Are the model results missing due to out-of-range salinity values?")+
  facet_grid(region ~ month(month, label=T))+
  theme_bw()+
  theme(legend.position = "bottom", axis.text.x=element_text(angle=45, hjust=1))

Plot the result

Create some plotting functions

neglop1p<-trans_new("neglop1p", transform=function(x) sign(x)*log(abs(x)+1), inverse=function(x) sign(x)*(exp(abs(x))-1))
plot_scenario_result <- function(scenario, group) {
  
  plot_data<-zoop_saladjusted%>%
    filter(IBMR%in%group)
  
  ggplot(plot_data,
         aes(x=year, y=.data[[paste0(scenario, "_median")]], ymin=.data[[paste0(scenario, "_l95")]], ymax=.data[[paste0(scenario, "_u95")]]))+
    geom_ribbon(alpha=0.4, fill="darkorchid4")+
    geom_line(alpha=0.4, color="darkorchid4")+
    scale_y_continuous(trans=neglop1p, breaks=c(-1000, -100, -10, -1, 0, 1, 10, 100, 1000))+
    ylab("Scenario/baseline (log scale)")+
    facet_grid(region ~ month(month, label=T))+
    theme_bw()+
    theme(legend.position = "bottom", axis.text.x=element_text(angle=45, hjust=1))
}
# Create plots for each Parameter
scenario_result_plots <- expand_grid(Scenario=unique(scenario_sal$Scenario)[-1],
                                     IBMR=unique(model_factors$IBMR))%>%
  mutate(plot=map2(Scenario, IBMR, ~plot_scenario_result(.x, .y)))

Result plots

sal_fallX2_hi

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_fallX2_low

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_sumX2_hi

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_sumX2_low

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_SMSCG

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_sumX2_WAN_low

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_sumX2_WAN_1

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_sumX2_WAN_2

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_sumX2_WAN_3

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_sumX2_WAN_high

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_fallX2_WAN_low

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_fallX2_WAN_1

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_fallX2_WAN_2

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_fallX2_WAN_3

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_fallX2_WAN_high

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other